package com.youdoneed.base.common;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;

public class TxtUtil {
    PrintStream ps = null;

    public PrintStream open(String parentPath,String fileName){
        File dir = new File(parentPath);
        if (!dir .exists()){
            dir.mkdir();
        }

        File file = new File(parentPath+fileName);
        try {

            ps = new PrintStream(new FileOutputStream(file));

        } catch (Exception e) {
            e.printStackTrace();
        }

        return ps;

    }
    public void write(String data) {
        ps.append(data);

    }

    public void close(){
        ps.close();
    }

}
